<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据分析话题报名系统</title>
    <link rel="stylesheet" href="/static/style.css">
</head>
<body>
    <div class="container">
        <h1>数据分析话题报名</h1>
        
        <!-- 提示信息 -->
        {% with messages = get_flashed_messages() %}
            {% if messages %}
                <div class="alert">
                    {% for message in messages %}
                        <p>{{ message }}</p>
                    {% endfor %}
                </div>
            {% endif %}
        {% endwith %}
        
        <!-- 报名表单 -->
        <form method="POST" action="/">
            <div class="form-group">
                <label for="name">姓名：</label>
                <input type="text" id="name" name="name" required>
            </div>
            
            <div class="form-group">
                <label for="student_id">学号（f开头+8位数字）：</label>
                <input type="text" id="student_id" name="student_id" required 
                       pattern="f\d{8}" title="格式：f开头+8位数字">
            </div>
            
            <div class="form-group">
                <label for="topic">报名话题：</label>
                <textarea id="topic" name="topic" rows="5" required></textarea>
            </div>
            
            <button type="submit">提交</button>
        </form>
        
        <!-- 历史记录 -->
        <h2>历史报名记录</h2>
        <table>
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>学号</th>
                    <th>话题</th>
                    <th>提交时间</th>
                </tr>
            </thead>
            <tbody>
                {% for entry in history %}
                <tr>
                    <td>{{ entry['姓名'] }}</td>
                    <td>{{ entry['学号'] }}</td>
                    <td>{{ entry['话题'] }}</td>
                    <td>{{ entry['提交时间'] }}</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</body>
</html>